package br.com.sovi.gwt.client;

import com.google.gwt.user.client.ui.HTML;
import com.gwtext.client.widgets.Panel;

public class ContatoCentralPanel extends Panel {

	public ContatoCentralPanel() {
		this.setPaddings(5);
		this.setAutoScroll(true);

		StringBuilder sb = new StringBuilder();
		
		sb.append("<div style='width:550px; '>");

		sb.append(createContato("João Eduardo Galli", "Desenvolvimento, Vendas e Dúvidas Técnicas", "joaogalli@sovi.com.br", "(44) 9931-0119"));
		sb.append("<br/>");
		sb.append(createContato("Marcos Alexandre Rodrigues", "Vendas", "vendas@sovi.com.br", null));
		
		sb.append("</div>");
		
		this.add(new HTML(sb.toString()));
	}

	private String createContato(String nome, String cargo, String email, String telefone) {
		StringBuilder sb = new StringBuilder();
		
		sb.append("<table width=\"100%\" border=\"0\"><tr><td width=\"6%\" rowspan=\"4\"><div align=\"center\"></div></td>");
		sb.append("<td width=\"94%\" class=\"contatoScreen_nome\">");
		sb.append(nome);
		sb.append("</td></tr><tr><td class=\"contatoScreen_campos\">");
		sb.append(cargo);
		sb.append("</td></tr><tr><td class=\"contatoScreen_campos\">E-Mail: ");
		sb.append(email);
		sb.append("</td></tr>");
		if (telefone != null) {
			sb.append("<tr><td class=\"contatoScreen_campos\">Telefone: ");
			sb.append(telefone);
			sb.append("</td></tr>");
		}
		sb.append("</table>");
		
		return sb.toString();
	}
	
}
